#include <stdio.h>

int divide1(int[], int);
int divide2(int[], int);
double divide3(int[], int);

int main()
{
    int len = 1, vec[len];
    printf("Input the vector length: ");
    scanf("%d", &len);

    printf("Input the vector: ");
    for (int i = 0; i < len; i++)
        scanf(" %d", &vec[i]);
    
    int A1 = divide1(vec, len), 
        A2 = divide2(vec, len);
    double A3 = divide3(vec, len);

    printf("Output: \n");
    if (A1 != 0) 
        printf("A1 = %d ", A1);
    else
        printf("A1 is NONE ");
    if (A2 != 0) 
        printf("A2 = %d ", A2);
    else
        printf("A2 is NONE ");
    if ((int)A3 != 0)
        printf("A3 = %.1f ", A3);
    else
        printf("A3 is NONE ");
    
    return 0;
}

int divide1(int vec[], int len)
{
    int result = 0;
    for (int i = 0; i < len; i++)
        if (vec[i] % 3 == 0 && result <= vec[i])
            result = vec[i];
    
    return result;
}

int divide2(int vec[], int len)
{
    int result = 0;
    for (int i = 0; i < len; i++)
        if ((vec[i] - 1) % 3 == 0)
            result++;
    
    return result;
}

double divide3(int vec[], int len)
{
    double result = 0, times = 0;
    for (int i = 0; i < len; i++) {
        if ((vec[i] - 2) % 3 == 0) {
            result += (double)vec[i];
            times++;
        }
    }

    return (times > 0) ? result / times : 0;
}